export function ResizePhotoImg(event) {
    var obj = event.target
    var src = obj.src,datasrc = obj.getAttribute('data-src')
    if(datasrc&& datasrc != src){
        return ;
    }
    var m_W = window.getComputedStyle(obj.parentNode,null).getPropertyValue("width").replace("px","");
    var m_H = window.getComputedStyle(obj.parentNode,null).getPropertyValue("height").replace("px","");
    var ratio = m_W/m_H;
    var i_W = obj.width;
    var i_H = obj.height;
    var left = obj.style.left, top=obj.style.top
    if(i_W>i_H*ratio){
        obj.style.height = "auto";
        obj.style.width = m_W + "px";
        obj.style.top = (!top||top=="0px")?-(((m_W/i_W)*i_H-m_H)/2) + "px":top;	
        obj.style.left = "0px";
    }else{
        obj.style.height = m_H + "px";
        obj.style.width = "auto";
        obj.style.left = (!left||left=="0px")?-(((m_H/i_H)*i_W-m_W)/2) + "px":left;
        obj.style.top = "0px";
    }
    return obj;
}
